package com.browan.constellation;

import com.browan.constellation.configuration.ResourceManager;
import com.browan.constellation.util.AssetsUtil;
import android.app.Activity;
import android.content.Intent;
import android.graphics.Color;
import android.graphics.Typeface;
import android.os.Bundle;
import android.view.Gravity;
import android.view.ViewGroup.LayoutParams;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ScrollView;
import android.widget.TextView;

public class ConDetial extends Activity
{

	@Override
	protected void onCreate(Bundle savedInstanceState)
	{
		super.onCreate(savedInstanceState);
		
		int id = getIntent().getIntExtra(Intent.EXTRA_UID, -1);
		setTitle(ResourceManager.NAMES[id]);
		
		
		
		String content = AssetsUtil.readAsset(this, id + ".txt");
		TextView tv = new TextView(this);
		tv.setTypeface(Typeface.DEFAULT, Typeface.BOLD);
		tv.setTextColor(Color.WHITE);
		
		
		tv.setText(content);
		ScrollView scrollView = new ScrollView(this);
		scrollView.setBackgroundResource(R.drawable.bg);
		LinearLayout layout = new LinearLayout(this);
		layout.setPadding(20,20, 20, 10);
		
		layout.setLayoutParams(new android.view.ViewGroup.LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.FILL_PARENT));
		layout.setOrientation(LinearLayout.VERTICAL);
		
		layout.setGravity(Gravity.CENTER);
		
		
		
		layout.addView(tv);
		
		ImageView img = new ImageView(this);
		
		img.setImageResource(ResourceManager.IMAGE_ID[id]);
		img.setAlpha(170);
		layout.addView(img);
		
		scrollView.addView(layout);
		
		
		setContentView(scrollView);
	}
}